<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- integrity-build-monolith-app-tutorial.qdoc -->
  <title>Building Monolith Project | Qt 5.14</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="index.html">Qt 5.14</a></td><td >Building Monolith Project</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.14.2 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
  <link rel="prev" href="integrity-building-qt-for-imx6quad-board.html" />
  <link rel="next" href="integrity-building-u-boot-image.html" />
<p class="naviNextPrevious headerNavi">
<a class="prevPage" href="integrity-building-qt-for-imx6quad-board.html">Building Qt for i.MX6 Quad Board</a>
<span class="naviSeparator">  &#9702;  </span>
<a class="nextPage" href="integrity-building-u-boot-image.html">Building U-Boot Image</a>
</p><p/>
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#building-monolith-project">Building Monolith Project</a></li>
<li class="level2"><a href="#defining-project-with-project-wizard">Defining Project with Project Wizard</a></li>
<li class="level2"><a href="#project-manager-settings">Project Manager Settings</a></li>
<li class="level2"><a href="#adding-file-system-mount-point">Adding File System Mount Point</a></li>
<li class="level2"><a href="#galcore-vas-settings">Galcore VAS Settings</a></li>
<li class="level2"><a href="#editing-galcore-project">Editing Galcore Project</a></li>
<li class="level2"><a href="#building-monolith-gpj">Building monolith.gpj</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Building Monolith Project</h1>
<span class="subtitle"></span>
<!-- $$$integrity-building-monolith.html-description -->
<div class="descr"> <a name="details"></a>
<p>In this tutorial, we build a monolith INTEGRITY project for a Qt example application. You can select any Qt example application that uses the <a href="qtwebassembly-platform-notes.html#supported-qt-modules">supported Qt modules</a>.</p>
<p>Before you can build a monolith INTEGRITY project, you need to prepare your build environment for the <code>qmake</code> build tool. You can do this by running the script <i>~/setEnvironment.sh</i> that you created in <a href="integrity-building-qt-for-imx6quad-board.html#creating-script-for-running-exports">Creating Script for Running Exports</a>.</p>
<p>Run the following commands in a terminal:</p>
<pre class="cpp plain">

  source ~/setEnvironment.sh
  &lt;Qt installation path&gt;/qtbase/bin/qmake &lt;Qt example application path&gt;/&lt;projectname&gt;.pro
  make

</pre>
<p>The <code>qmake</code> tool must be called under the Qt installation path (&lt;Qt installation path&gt;), where you installed the Qt sources in <a href="integrity-building-qt-for-imx6quad-board.html#getting-qt-source-code">Getting Qt Source Code</a>.</p>
<p>&lt;Qt example application path&gt;/&lt;projectname&gt;.pro is the installation path of the Qt example application project file that the monolith INTEGRITY project will be built for.</p>
<a name="building-monolith-project"></a>
<h2 id="building-monolith-project">Building Monolith Project</h2>
<p>To build a monolith INTEGRITY project, create an empty directory for your project in your home folder. In the steps below, we use the directory name <i>mymonolith</i>.</p>
<a name="defining-project-with-project-wizard"></a>
<h3 id="defining-project-with-project-wizard">Defining Project with Project Wizard</h3>
<p>Launch MULTI Launcher and select <b>File</b> &gt; <b>Create New Project</b>. Define your monolith project with Project Wizard:</p>
<ol class="1" type="1"><li>In the <b>Project name</b> tab, fill in the <b>Directory</b> field with the directory you just created.</li>
<li>Select <b>Next</b>.</li>
<li>In the <b>Operating System</b> tab, select <i>INTEGRITY</i> from the <b>Operating System</b> list.<p><b>Note: </b>The <b>OS Distribution Directory</b> field must contain your INTEGRITY installation directory (in our example, <i>mymonolith</i>).</p></li>
<li>Select <b>Next</b>.</li>
<li>In the <b>Processor Family</b> tab, select <b>ARM</b>.</li>
<li>Select <b>Next</b>.</li>
<li>In the <b>Target Board</b> tab, select <b>ARM Cortex-A9 Platform </b> from the target board list.</li>
<li>Select <b>Finish</b>.</li>
</ol>
<p class="centerAlign"><img src="images/project-wizard.png" alt="" /></p><p>After selecting <b>Finish</b> in Project Wizard, Project Manager is opened.</p>
<a name="project-manager-settings"></a>
<h3 id="project-manager-settings">Project Manager Settings</h3>
<p>With Project Manager you can define the settings for the monolith project:</p>
<ol class="1" type="1"><li>In the <b>Select Item to Add</b> dialog page, select <b>Monolith</b> from the <b>Create New</b> list.<p class="centerAlign"><img src="images/select-item-to-add.png" alt="" /></p></li>
<li>Select <b>Next</b>.</li>
<li>In the <b>Settings for Monolith</b> dialog, define the settings:<ul>
<li><b>Source Code Directory</b> is your project directory (in our example, <i>mymonolith</i>).</li>
<li><b>Project Name</b> is the name of your project. In our example, we use the name <i>myproject</i>.</li>
<li><b>Language</b> must be <b>C</b>. The Qt projects are C++ projects, but this will be configured later.</li>
<li>Select <b>Next</b>.</li>
<li><b>Use Shared Libraries</b> should not be selected.</li>
<li>Select <b>Next</b>.</li>
</ul>
</li>
<li>In the <b>Configure number of Virtual AddressSpaces</b> dialog page, select the checkbox <b>Names of Virtual Address Spaces</b> and type <i>galcore</i>.</li>
<li>Select <b>Next</b>.</li>
<li>In the <b>Settings for Kernel</b> dialog page, type the name of your kernel.</li>
<li>Select <b>Debugging</b>, <b>Dynamic Load</b> and <b>ResourceManager</b> from the <b>Kernel Libraries</b> list.<p class="centerAlign"><img src="images/kernel-settings.png" alt="" /></p></li>
<li>Select <b>Next</b>.</li>
<li>In the <b>Settings for OS Module Selection</b> dialog page, select <b>File System (User Configured)</b> and <b>GHnet IPv4 Stack (Virtual)</b> from the <b>OS Module</b> list.</li>
<li>Select <b>Next</b>.</li>
<li>In the <b>Settings for File System (User Configured)</b> dialog page, select a filesystem that your monolith project supports.<p>In our example, we have selected <b>MSDOS FAT</b> from the <b>Libraries</b> list.</p>
</li>
<li>Select <b>Finish</b>.</li>
<li>In the <b>Settings for Add File System Clients</b> dialog page, select <b>Finish</b>.</li>
</ol>
<a name="adding-file-system-mount-point"></a>
<h3 id="adding-file-system-mount-point">Adding File System Mount Point</h3>
<p>You need to configure the file system to use the first partition of the micro SD card. In the MULTI Project Manager view, you see a tree structure of your monolith project:</p>
<ol class="1" type="1"><li>Right-click the file <i>mounttable.c</i> to open the context menu.</li>
<li>Select <b>Modify Project</b> &gt; <b>Add INTEGRITY File System Mount Point</b>.</li>
<li>In the <b>Settings for FS MountPoint</b> dialog, define the settings:<ul>
<li>Type <i>/</i> to <b>Mount Directory</b>.</li>
<li>Select <b>Next</b>.</li>
<li><b>File System Type</b> is <i>MSDOS FAT</i>.</li>
<li>Select <b>Next</b>.</li>
<li>Select the <b>Use Physical Device</b> radio button.</li>
<li>Type <i>SDCardDev1</i> to the <b>Device</b> field.</li>
<li><b>Slice</b> is <i>a</i>.</li>
<li>Select <b>Finish</b>.</li>
</ul>
</li>
</ol>
<a name="galcore-vas-settings"></a>
<h3 id="galcore-vas-settings">Galcore VAS Settings</h3>
<p>Next, define the virtual address space (VAS) settings for your project.</p>
<p>In the MULTI Project Manager view, you see a tree structure of your monolith project:</p>
<ol class="1" type="1"><li>Double-click the .int file in your project (1) (in the steps below, <i>myproject.int</i>).</li>
<li>In the opened window, double-click the galcore virtual address space (VAS) area (2).<p class="centerAlign"><img src="images/project-view.png" alt="" /></p></li>
<li><b>VirtualAddressSpace Options</b> dialog is opened.</li>
<li>In the <b>Attributes</b> tab, select the values defined in <a href="integrity-building-monolith.html#values-in-attributes-tab">Values in Attributes Tab</a>.</li>
<li>Select <b>OK</b>.</li>
<li>In the galcore virtual address space area, double-click the <b>Task Initial</b> area (3).<p class="centerAlign"><img src="images/project-view-2.png" alt="" /></p></li>
<li>Select the <b>Start Automatically</b> check box.</li>
<li>Select <b>OK</b>.</li>
</ol>
<a name="values-in-attributes-tab"></a>
<h4 id="values-in-attributes-tab">Values in Attributes Tab</h4>
<p>Add the following attribute values for the virtual address space:</p>
<div class="table"><table class="generic" width="80%">
 <thead><tr class="qt-style"><th >Attribute</th><th >Value</th></tr></thead>
<tr valign="top" class="odd"><td >Maximum Priority</td><td >255</td></tr>
<tr valign="top" class="even"><td >Maximum Weight</td><td >255</td></tr>
<tr valign="top" class="odd"><td >Memory Pool Size</td><td >2000P</td></tr>
<tr valign="top" class="even"><td >Heap Size</td><td >0X2000000</td></tr>
<tr valign="top" class="odd"><td >Heap Extension Reserved Size</td><td >0x20000</td></tr>
<tr valign="top" class="even"><td >Arguments</td><td >Leave blank.</td></tr>
<thead><tr class="qt-style"><th >Checkbox</th><th >Value</th></tr></thead>
<tr valign="top" class="odd"><td >Create Extra Virtual Memory Regions</td><td >Select the checkbox.</td></tr>
</table></div>
<a name="editing-galcore-project"></a>
<h3 id="editing-galcore-project">Editing Galcore Project</h3>
<p>You need to edit a number of files in the monolith project.</p>
<a name="file-galcore-c"></a>
<h4 id="file-galcore-c">File galcore.c</h4>
<ol class="1" type="1"><li>Select <i>galcore.c</i> from the tree structure in the MULTI Project Manager view.</li>
<li>Double-click the file to open it for editing.</li>
<li>Add the following code to <i>galcore.c</i>:<pre class="cpp plain">

  #include &lt;INTEGRITY.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  extern Error GalCore_TaskInit(void);
  int main(void) {
      Error E;
      E = GalCore_TaskInit();
      if (E != Success) {
          printf(&quot;Failed to start GalCore tasks\n&quot;);
      }
      Exit(0);
  }

</pre>
</li>
</ol>
<a name="file-galcore-gpj"></a>
<h4 id="file-galcore-gpj">File galcore.gpj</h4>
<ol class="1" type="1"><li>Select <i>galcore.gpj</i> from the tree structure in the MULTI Project Manager view.</li>
<li>Right-click the file to open the context menu.</li>
<li>Select <b>Edit</b>.</li>
<li>Add the file <i>libgalcore.a</i> to <i>galcore.gpj</i>.</li>
</ol>
<p>Contents of <i>galcore.gpj</i> should be as follows:</p>
<pre class="cpp plain">

  #!gbuild
  #component integrity_virtual_address_space
  [Program]
      -lgalcore
  tgt/INTEGRITY.ld
  galcore.c

</pre>
<a name="file-kernel-gpj"></a>
<h4 id="file-kernel-gpj">File kernel.gpj</h4>
<ol class="1" type="1"><li>Select <i>kernel.gpj</i> from the tree structure in the MULTI Project Manager view.</li>
<li>Right-click the file to open the context menu.</li>
<li>Select <b>Edit</b>.</li>
<li>Add the file <i>libgalcore-iod.a</i> to <i>kernel.gpj</i>.</li>
</ol>
<p>Contents of <i>kernel.gpj</i> should be as follows:</p>
<pre class="cpp plain">

  #!gbuild
  #component integrity_kernel_monolith
  [Program]
      -kernel
      -ldebug
      -lload
      -lres
      -lgalcore-iod
  tgt/default.ld
  myproject_kernel.c
  global_table.c

</pre>
<a name="file-monolith-gpj"></a>
<h4 id="file-monolith-gpj">File monolith.gpj</h4>
<ol class="1" type="1"><li>Select <i>monolith.gpj</i> from the tree structure in the MULTI Project Manager view.</li>
<li>Righ-click the file to open the context menu.</li>
<li>Select <b>Edit</b>.</li>
<li>Add the additional library directory <i>$(__LIBS_DIR_BASE)/Vivante</i>.</li>
</ol>
<p>Contents of <i>monolith.gpj</i> should be as follows:</p>
<pre class="cpp plain">

  #!gbuild
  #component integrity_monolith
  [INTEGRITY Application]
      -non_shared
     -I$__OS_DIR/modules/ghs/ghnet2/source/kernel/integrity/ip4server :sourceDir=$__OS_DIR/modules/ghs/ghnet2/source/kernel/integrity/ip4server
     -L$(__LIBS_DIR_BASE)/Vivante
  tgt/default.bsp
  myproject.int
  galcore.gpj [Program]
  myproject_kernel.gpj [Program]
  my_ivfsserver_module.gpj [Program]
  ip4server_module.gpj [Program]

</pre>
<a name="int-file"></a>
<h4 id="int-file">.int File</h4>
<ol class="1" type="1"><li>Select the <i>.int</i> file of your project from the tree structure in the MULTI Project Manager view.</li>
<li>Right-click the file to open the context menu.</li>
<li>Select <b>Edit</b>.</li>
<li>Add the following lines at the end of the file.<p><b>Note: </b>Replace &lt;/path/to/your/app/executable&gt; with a path to your application executable.</p><pre class="cpp plain">

  AddressSpace
      Name    myappname
      Filename    /path/to/your/app/executable
      MemoryPoolSize 0x2000000
      Language    C++
      HeapSize    0x6000000

      Task Initial
          StackSize    0x30000
          StartIt    true
      EndTask
      HeapExtensionReservedSize    0x2000000
  EndAddressSpace

</pre>
</li>
</ol>
<a name="building-monolith-gpj"></a>
<h3 id="building-monolith-gpj">Building monolith.gpj</h3>
<p>Open <i>monolith.gpj</i> from the tree structure in the MULTI Project Manager view. To build the project:</p>
<ol class="1" type="1"><li>Right-click <i>monolith.gpj</i> to open the context menu.</li>
<li>Select <b>Build</b>.</li>
</ol>
<p>Your monolith project is now ready to be packaged for U-Boot.</p>
</div>
<!-- @@@integrity-building-monolith.html -->
<p class="naviNextPrevious footerNavi">
<a class="prevPage" href="integrity-building-qt-for-imx6quad-board.html">Building Qt for i.MX6 Quad Board</a>
<span class="naviSeparator">  &#9702;  </span>
<a class="nextPage" href="integrity-building-u-boot-image.html">Building U-Boot Image</a>
</p>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2020 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
